package com.lijie.bs_recruit.config;


import com.lijie.bs_recruit.controller.MyInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

//    @Value("${file.uploadurl}")
//    private String  fileUrl;

    /**
     * 注册拦截器
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new MyInterceptor())
                .addPathPatterns("/**") //拦截所有的路径
                .excludePathPatterns("/**/*.png", "/**/*.jpg","/**/*.jpeg", "/**/*.gif")
                .excludePathPatterns("/LoginRegister/**")  //不拦截
                .excludePathPatterns("/admin/login/**")  //不拦截
                .excludePathPatterns("/jobfaircompany/**")
                .excludePathPatterns("/jobfair/**")
                .excludePathPatterns("/position/selectPosition/**")
                .excludePathPatterns("/position/selPositionById/**")
                .excludePathPatterns("/company/selCompanyById/**")
                .excludePathPatterns("/company/selCompanyList/**")
                .excludePathPatterns("/company/companyImage/**")
                .excludePathPatterns("/resume/headerImg/**")
                .excludePathPatterns("/jobfair/headerImg/**")
                .excludePathPatterns("/news/selJobfaircompanyByUser/**")
                .excludePathPatterns("/news/addNewsLookNum/**")
                .excludePathPatterns("/news/selNewsById/**")
                .excludePathPatterns("/app/**");
    }



//    public void addResourceHandlers(ResourceHandlerRegistry register){
//        register.addResourceHandler("/images/**").addResourceLocations("file:"+fileUrl);
//    }


}
